import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/res/colors.dart';
import 'package:ls_work/viewmodel/food/send_food_table_view_model.dart';

class SendFoodTablePage extends BaseStatefulMvvmWidget {
  final String? titleName;
  final String? buildingId;
  final String? floorId;

  SendFoodTablePage({this.titleName, this.buildingId, this.floorId});

  @override
  State<StatefulWidget> createState() => _SendFoodTableState();
}

class _SendFoodTableState
    extends BaseMvvmListState<SendFoodTableViewModel, SendFoodTablePage> {
  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return Scaffold(
      appBar: AppBar(
        title: Text('${widget.titleName}今日配餐'),
      ),
      backgroundColor: Colours.bg_color,
      body: loadingContentWidget,
    );
  }
  
  @override
  Widget buildLoadingContentView() {
   
    return Column(
      children: [
        viewModel.contentView(),
        super.buildLoadingContentView()!.setWeight(1)
      ],
    );
  }

  @override
  Widget createItemWidget(int index) {
    return viewModel.itemContent(index);
  }

  @override
  SendFoodTableViewModel createViewModel() {
    return SendFoodTableViewModel(context,
        titleName: widget.titleName,
        buildingId: widget.buildingId,
        floorId: widget.floorId);
  }

  @override
  bool get canPullUp => true;
}

